% P = 5;
% tau = 0.5;
% L = 2+1/P+tau;
% 
% [g,x] = pulse(tau,L,P);
% 
% plot(x, g, '*')

P = 5;
tau=[0.1 0.6]';
beta=[1*exp(i*rand()*pi/2) 0.7*exp(i*rand()*pi/2)]';
L = 2+1/P+0.6;
h = channel(tau,beta,L,P);

N=50;
s = source(N);

x = gen_data1(h,s,P,N);

figure(1)
subplot(2,1,1); 
plot(real(s), '*')
title('Source (real part)')
subplot(2,1,2);
plot(real(x), '*')
title('Output (real part)')

figure(2)
subplot(2,1,1); 
plot(imag(s), '*')
title('Source (imaginary part)')
subplot(2,1,2);
plot(imag(x), '*')
title('Output (imaginary part)')

figure(3)
subplot(2,1,1); 
plot(real(h), '*')
title('H (real part)')
subplot(2,1,2);
plot(imag(h), '*')
title('H (imaginary part)')